<?php
class DeleteAction extends CAction {

	public function run($id = null) {
		$modelName = $this->controller->modelName;
		$model = $this->controller->loadModel($id);
		$result = $model->delete();
		
		if(Yii::app()->request->isAjaxRequest) {
			echo CJSON::encode($result ? '操作成功' : '操作失败');
			Yii::app()->end();
		} else {
			Yii::import('lib.helpers.CControllerHelper');
			CControllerHelper::redirectReferrer();
		}
	}
	
	
}

?>